Hello all I am trying to write a program in c++ to automatically detect the roads on a selected area of the map. I was able to do detect the roads from the Ways and tags attached to them. But I could not find any specific tag that is related to an intersection between two roads. Only thing close to is a traffic signal tag. I was wondering if any one know more authentic way to determine the intersections. Hope my question was not ambiguous. asked 23 Aug '12, 13:56 jawadch |
In the OSM XML for a way, you'll see data such as:
That indicates a node that is part of your way. If that exists in two ways, those ways join. answered 23 Aug '12, 14:00 SomeoneElse ♦ I checked it and it is true for the case in which two streets are intersecting. But is it also true for the case when on street e.g. a residential is ending in a main street?
(23 Aug '12, 14:03)
jawadch
1
Yes, it should be. If not, someone hasn't joined the roads properly, as described here.
(23 Aug '12, 14:05)
SomeoneElse ♦
Thanks a lot. I should be able to detect it now.
(23 Aug '12, 14:08)
jawadch
If one way street is going from south to north(longitude will be increasing) will the node references in the Way of that street will be such that the longitude of the first node ref is minimum and the longitude of the last node ref will be max. In short are the node ref in Way of "one way" roads along the direction of that road?
(23 Aug '12, 14:52)
jawadch
2
Yes - here's a stretch of oneway road (it has the tag "oneway=yes" and runs from south to north). The first node is at the south end and the end node is at the north end. As you can see, the references of the nodes may vary (later nodes have higher reference numbers) but the order of nodes in the way will be in the order that they appear on the ground.
(23 Aug '12, 15:09)
SomeoneElse ♦
Thanks a lot again :)
(23 Aug '12, 15:23)
jawadch
3
As an addidtion to the oneway issue, there are also other tags (although not much used). oneway=-1 means the nodes are ordered in opposite direction (when the way goes from S to N, the nodes are oredered from N to S) And some discouraged alternatives like "true" and "reversed" instead of "yes" and "-1": http://wiki.openstreetmap.org/wiki/Oneway
(23 Aug '12, 16:29)
Sanderd17
I have extracted the intersections that I need, my question is how to detect each twe adjacent intersection so I can define an adge to connect them and create a connected graph of inresection nodes. Thank you in advance for helps
(10 Apr '14, 12:45)
Angeasg
showing 5 of 8
show 3 more comments
|
I have extracted the intersections that I need, my question is how to detect each twe adjacent intersection so I can define an adge to connect them and create a connected graph of inresection nodes. Thank you in advance for helps
permanent link
This answer is marked "community wiki".
answered 10 Apr '14, 12:45 Angeasg You might do better asking a new question describing what you're trying to do rather than asking a new question in an answer to an old one :)
(10 Apr '14, 13:08)
SomeoneElse ♦
|
Hi,, can y send me the code ? I need to do the same and return the name os intersection, but I dont know how.. Tanks.. answered 27 Jun '17, 13:19 mneto |